<?php
$colors =array(
"000000"=>"Black",
"000080"=>"Navy",
"0000FF"=>"Blue",
"002147"=>"Bleu marine",
"002395"=>"Dark blue",
"006400"=>"Dark Green",
"008000"=>"Office green",
"008080"=>"Teal",
"00A86B"=>"Jade",
"00FF7F"=>"Spring Green",
"00FFFF"=>"Cyan",
"123524"=>"Phthalo Green",
"138808"=>"India green",
"1E90FF"=>"Dodger Blue",
"32CD32"=>"Green",
"32CD32"=>"Lime Green",
"3D2B1F"=>"Noir",
"3EB489"=>"Mint Leaf",
"40E0D0"=>"turquoise",
"6495ED"=>"Cornflower blue",
"66FF00"=>"Bright green",
"6F00FF"=>"Indigo",
"78184A"=>"dark purple",
"800000"=>"Bordeaux",
"800080"=>"Bright purple",
"800080"=>"purple",
"808080"=>"Grey",
"882D17"=>"Chocola",
"8B0000"=>"DarkRed",
"8DB600"=>"Apple Green",
"8F00FF"=>"Violet",
"9400D3"=>"Dark Violet",
"967117"=>"beige foncé",
"9966CC"=>"Amethyst",
"A9A9A9"=>"Dark grey",
"AAF0D1"=>"Magic Mint",
"ACACAC"=>"Pewter",
"ADD8E6"=>"Light Blue",
"AE6838"=>"Tan2",
"B57EDC"=>"Lavender",
"BD33A4"=>"Byzantine",
"BFFF00"=>"Lime",
"C0C0C0"=>"Silver",
"C71585"=>"Red violet",
"CCFF00"=>"Jaune citron",
"D2B48C"=>"Tan1",
"D3D3D3"=>"Light gray",
"D4AF37"=>"Gold",
"DA70D6"=>"Orchid",
"DE3163"=>"Cerise",
"E62020"=>"True red",
"E6E6FA"=>"Light violet",
"E75480"=>"Dark pink",
"F2BDCD"=>"Orchid pink",
"F3E5AB"=>"Vanilla",
"F4F0EC"=>"Offwhite",
"F5F5DC"=>"Beige",
"F5F5F5"=>"White smoke",
"FA8072"=>"Salmon",
"FAD6A5"=>"champange",
"FF0000"=>"Bright red",
"FF007F"=>"Rose",
"FF00FF"=>"Fuchsia",
"FF1493"=>"Fuchsia fluo",
"FF3F00"=>"Orange red",
"FF4F00"=>"Orange fluo",
"FF5349"=>"Red orange",
"FF69B4"=>"Hot pink",
"FF7F00"=>"Orange",
"FF7F50"=>"Coral",
"FFB6C1"=>"Light pink",
"FFD700"=>"Gold",
"FFFDD0"=>"Cream",
"FFFF00"=>"Yellow",
"FFFFF0"=>"Ivory",
"FFFFFF"=>"White"
);
?>
<script type="text/javascript">
 //<![CDATA[ 
	var _img='<img src="';
	var _img_end='"  alt="" />';
	function showStone(src){
		$('#imgStone').attr('src','<?echo base_url()?>/images/'+src);
		$('#showStone').show('slow');
	}
//]]>
</script>
<div class="row">


				<div class="span6">
					<div class="row">

						<div class="product-details clearfix">
							<div class="span6">
								
								<div class="product-img">
								<?php
									$photo	= theme_img('no_picture.png', lang('no_image_available'));
									if($product->primary_photo)
										$photo	= '<img src="'.base_url('images/'.$product->primary_photo).'" alt="'.$product->seo_title.'"/>';
									?>
									<a class="fancybox" href="<?php echo base_url('images/'.$product->primary_photo)?>"><?php echo $photo?></a>
								</div><!--end product-img-->
								<?php 
								if(count($product->images) > 1):?>
								<div class="product-img-thumb">
										<?php foreach($product->photos as $image):?>
											<a class="fancybox" href="<?php echo base_url('images/thumbnails/'.$image);?>"><img src="<?php echo base_url('images/thumbnails/'.$image);?>" alt="<?php echo $product->seo_title?>"></a>
										<?php endforeach;?>
								</div>
								<?php endif;?>
								<!--end flexslider-thumb-->
							</div><!--end span6-->
						</div><!--end product-details-->

					</div><!--end row-->
					

				</div><!--end span6-->


				<div class="span6">
				
					<div class="product-title">
						<h3><?php echo $product->name;?></h3>
					</div>
					
					
					<div class="product-set">
						<div class="row">
							<div class="span8">
								<?php echo $product->excerpt;?>
							</div>
						</div>
						<div class="product-info">
							<dl class="dl-horizontal">
							  <dt>Diponiblité:</dt>
							  <dd>En Stock</dd>
	
							  <dt>Product Ref:</dt>
							  <dd>No. <?php echo $product->id.' or '.$product->sku; ?></dd>
	
							</dl>
						</div>
						<div class="product-price">
							<span>
								<span class="strike-through"><?php echo (int)$product->price?format_currency($product->price):''; ?></span>
								$<span id="priceProduct"><?php echo $product->saleprice ?></span>
							</span>
						</div>
						<div class="product-inputs">
							<?php echo form_open('cart/add_to_cart', 'class="form-horizontal"');?>
							<input type="hidden" name="cartkey" value="<?php echo $this->session->flashdata('cartkey');?>" />
							<input type="hidden" name="id" value="<?php echo $product->id?>"/>
							<input type="hidden" name="price" id="price"  value="<?php echo $product->saleprice?>"/>
							
							<div class="input-append">
								<select class="span1" name="quantity" id="quantity">
					                <option value="1">1</option>
					                <option value="2">2</option>
					                <option value="3">3</option>
					                <option value="4">4</option>
					                <option value="5">5</option>
					                <option value="6">6</option>
					                <option value="7">7</option>
					                <option value="8">8</option>
					                <option value="9">9</option>
					                <option value="10">10</option>
					                <option value="">type</option>
					            </select>
								<button class="btn btn-primary"><i class="icon-shopping-cart"></i> <?php echo lang('form_add_to_cart');?></button>
							</div>
							<script type="text/javascript">
							$( "#quantity" ).change(function() {
									if($(this).val()=='') {
										$(this).parent().prepend('<input type="text" placeholder="<?php echo lang('quantity') ?>" value="" name="quantity" class="span1"/>');
										$(this).remove();
									}
								});
							</script>
							
							<div id="selectColor" class="fright">
										<strong class="fleft text2">Feel free to change your color:
											<input value="<?php echo $product->prd_color?>" type="hidden" name="color" id="prd_color"/>
										    <div class="btn-group">
										    <a class="btn btn-large dropdown-toggle" id="select_color" data-toggle="dropdown" href="#" style="background:url('<?php echo base_url('/images/color/'.$product->prd_color.'.jpg')?>')">
										    Color
										    <span class="caret"></span>
										    </a>
										    <ul  id="dropboxColor" class="dropdown-menu">
										    	<?php
										    		foreach($colors as $code=>$color) {
														echo '<li data-color="'.$code.'" title="'.$color.'"  style="background:url(\''.base_url('/images/color/'.$code.'.jpg')."')\" > $color </li>";
													  }
												?>
										    </ul>
										    <script type="text/javascript">
										    	$('#dropboxColor li').click(function(){
											    	$('#prd_color').val($(this).data('color'));
											    	$('#select_color').attr('style',$(this).attr('style'));
												});

										    </script>
										    </div>
										
										</strong>
										
										</div>
										<div id="stone" class="clear">
											<label class="btn_stone radio" id="noStone"><input type="radio" name="stone" value="-20"/> Not stone (-20$)</label>
											<label class="btn_stone radio" id="highStone">
												<input type="radio" name="stone" value="100"/> high quality stone(+100$) 
												<a   data-toggle="modal" href="#High-quality-stone"><img class="imgModal" src="<?php echo base_url('/images/measure/High-quality-stone-small.png')?>" title="High-quality-stone"/></a>
											</label>
											<label class="btn_stone radio" id="mediumStone">
												<input type="radio" name="stone" value="0" checked /> medium quality stone 
												<a   data-toggle="modal" href="#stone-Small"><img  class="imgModal" src="<?php echo base_url('/images/measure/stone-small.png')?>" title="stone" /></a>
												</label>
										</div>
										<!-- Modal -->
										<div id="High-quality-stone" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="High-quality-stone" aria-hidden="true">
											<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
											</div>
											<div class="modal-body">
											<img src="<?php  echo base_url('images/measure/High-quality-stone.jpg')?>" />
											</div>
										</div>
										
										<div id="stone-Small" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="stone-Small" aria-hidden="true">
											<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
											</div>
											<div class="modal-body">
											<img src="<?php  echo base_url('images/measure/stone.jpg')?>" />
											</div>
										</div>
										
										<!-- END Modal -->
										<div id="size" class="clear">
										<strong class="fleft text2">Size:
											<select name="size" id="SelectSize">
													  <?php foreach(array('Small','Medium','Large') as $i) {
														  if($i==$_POST['size'])$s='selected="selected"';
														  else $s='';
														   echo "<option value=\"$i\" $s >$i</option>";
													  }
														?>
											</select>
										</strong>
										
											<?php echo theme_js('convert.js', true);?>
										
										</div>
									<table class="messure clear" border="0">
									<caption>Measure your size (foot or inches or cm) and replace in table</caption>
									  <thead>
										<tr id="">
										  <th></th>
										  <th>Foot</th>
										  <th>Inches</th>
										  <th>Cm</th>
										</tr>
									  </thead>
									  <?php
									  function MeasureSize($tr=array()){
										if(empty($tr)) return '
									  <tr>
										<td> &nbsp; </td>
										<td></td>
										<td></td>
										<td></td>
									  </tr>
										';
										
										return '
									  <tr id="'.$tr['id'].'">
										<td align="right" width="63%"><div align="left"><strong>'.$tr['text'].' :</strong></div></td>
										<td><input class="foot input-mini"  id="foot_'.$tr['num'].'"  size="5" maxlength="5" type="text" /></td>
										<td><input class="inches input-mini"  id="inches_'.$tr['num'].'" size="5" maxlength="5" type="text" /></td>
										<td><input class="cm input-mini"  id="cm_'.$tr['num'].'" title="'.$tr['id'].'_'.$tr['num'].'" name="cm['.$tr['id'].']" size="5" maxlength="5" type="text" value="" /></td>
									  </tr>
										';
									  }
									  ?>
									 
									<?php
									/* Ao nam la :  1  2  (BỎ QUA 2 bis) 4 5 6 7 8 9 10 12 13 15
									QUAN :  4 5 6 11 12*/

									//ao nu

									  if(!in_array($product->prd_type,array("chemise","pantalon"))){

									  echo MeasureSize(array('id'=>"Round_neck",'text'=>"1. Neck",'num'=>1));
									  echo MeasureSize(array('id'=>"bust",'text'=>"2. Bust and cups",'num'=>2));
									?>
									  
									  <tr id="cups">
										<td align="right"><div align="left"><strong>2bis. cups :</strong></div></td>
										<td>
											<select name="cm[cups]" title="cups_2bis" class="input-mini cm" >
													  <?php foreach(array('A','B','C','D','E','F','G') as $i) {
														  if($i==$_POST['cm[cups]'])$s='selected="selected"';
														  else $s='';
														   echo "<option value=\"$i\" $s >$i</option>";
													  }
														?>
											</select> 
										</td>
									  </tr>
									  
									  <?php echo MeasureSize(array('id'=>"Under_bust",'text'=>"3. Under bust",'num'=>3));
										echo MeasureSize(array('id'=>"Waist",'text'=>"4. Waist",'num'=>4));
										echo MeasureSize(array('id'=>"Hip",'text'=>"5. High Hip (10cm below waist)",'num'=>5));
										echo MeasureSize(array('id'=>"Full_hips",'text'=>"6. Hips",'num'=>6))?>

									  <?php echo MeasureSize(array('id'=>"Wrist",'text'=>"7. Wrist",'num'=>7))?>

									  <?php echo MeasureSize(array('id'=>"Biceps",'text'=>"8. Biceps",'num'=>8))?>

									  <?php echo MeasureSize(array('id'=>"Sleeve_length",'text'=>"9. Sleeve length from (shoulder point to wrist)",'num'=>9))?>

									  <?php echo MeasureSize(array('id'=>"Heigh_bus",'text'=>"10. Heigh of bust (neck to crotch)",'num'=>10))?>

									  <?php echo MeasureSize(array('id'=>"Length_legs",'text'=>"11. Length of legs",'num'=>11))?>

									  <?php echo MeasureSize(array('id'=>"Height",'text'=>"12. Total Height(above head to floor)",'num'=>12))?>

									  <?php echo MeasureSize(array('id'=>"Shoulder_width",'text'=>"13. Shoulder width ",'num'=>13))?>

									  <?php echo MeasureSize(array('id'=>"Dress_Length",'text'=>"14. Dress Length (from shoulder to longest point desired)",'num'=>14))?>
									  
									  <?php echo MeasureSize(array('id'=>"Around_body",'text'=>"15. Around the body (from shoulder through crotch and back to shoulder)",'num'=>15))?>

									<?php
									}
									// END ao nu
									/* Ao nam la :  1  2  (BỎ QUA 2 bis) 4 5 6 7 8 9 10 12 13 15
									QUAN :  4 5 6 11 12*/


									  if($product->prd_type=='chemise'){
										 echo MeasureSize(array('id'=>"Round_neck",'text'=>"1. Neck",'num'=>1));
										 echo MeasureSize(array('id'=>"bust",'text'=>"2. Bust and cups",'num'=>2));
										 echo MeasureSize(array('id'=>"Waist",'text'=>"4. Waist",'num'=>4)); 
										 echo MeasureSize(array('id'=>"Hip",'text'=>"5. High Hip (10cm below waist)",'num'=>5));
										 echo MeasureSize(array('id'=>"Full_hips",'text'=>"6. Hips",'num'=>6));
										 echo MeasureSize(array('id'=>"Wrist",'text'=>"7. Wrist",'num'=>7));
										 echo MeasureSize(array('id'=>"Biceps",'text'=>"8. Biceps",'num'=>8));
										 echo MeasureSize(array('id'=>"Sleeve_length",'text'=>"9. Sleeve length from (shoulder point to wrist)",'num'=>9));
										 echo MeasureSize(array('id'=>"Heigh_bus",'text'=>"10. Heigh of bust (neck to crotch)",'num'=>10));
										 echo MeasureSize(array('id'=>"Height",'text'=>"12. Total Height(above head to floor)",'num'=>12));
										 echo MeasureSize(array('id'=>"Shoulder_width",'text'=>"13. Shoulder width ",'num'=>13));
										 echo MeasureSize(array('id'=>"Around_body",'text'=>"15. Around the body (from shoulder through crotch and back to shoulder)",'num'=>15));
										 echo MeasureSize();
										 echo MeasureSize();
										 echo MeasureSize();
									  }
									  if($product->prd_type=='pantalon'){
										 echo MeasureSize(array('id'=>"Waist",'text'=>"4. Waist",'num'=>4)); 
										 echo MeasureSize(array('id'=>"Hip",'text'=>"5. High Hip (10cm below waist)",'num'=>5));
										 echo MeasureSize(array('id'=>"Full_hips",'text'=>"6. Hips",'num'=>6));
										 echo MeasureSize(array('id'=>"Length_legs",'text'=>"11. Length of legs",'num'=>11));
										 echo MeasureSize(array('id'=>"Height",'text'=>"12. Total Height(above head to floor)",'num'=>12));
										 echo MeasureSize(array('id'=>"Shoulder_width",'text'=>"13. Shoulder width ",'num'=>13));										 
										 echo MeasureSize();
										 echo MeasureSize();
										 echo MeasureSize();
										 echo MeasureSize();
										 echo MeasureSize();
										 echo MeasureSize();
										 echo MeasureSize();
										 echo MeasureSize();
										 echo MeasureSize();
									  }
									?> 
									</table>
									Note: <br/>
									<textarea rows="5" class="row-fluid" name="note" placeholder="If you would like to make a Special Measure request, please type here"></textarea>
									<br/>
									<button class="btn btn-primary"><i class="icon-shopping-cart"></i> <?php echo lang('form_add_to_cart');?></button>
									
									<script type="text/javascript">
									 //<![CDATA[
									 
									$(".messure tbody tr").mouseover(function() {
										var photo=$(this).attr("id");
										$(".messure").css("background","url(<?php echo base_url('images/measure')?>/"+photo+".jpg) no-repeat left top");
									});
									 
									function cart_load_url(){
										var measure='';
										$('.cm').each(function(index) {
											measure+=$(this).attr('title') + ': ' + $(this).val()+',';
										});
										measure+='color: ' + $('#color').val()+',';	
										measure+='stone: ' + $('input:radio[name=stone]:checked').val();
										var cart_load_url='cart_load/?product_id='+$('#product_id').val()+'&qty='+$('#qty').val()+'&price='+$('#price').val()+'&stone='+$('input:radio[name=stone]:checked').val()+'&measure='+encodeURIComponent(measure);
										return cart_load_url;
									}
									 //]]>
									</script>
								
							<?php echo form_close()?>
						</div>
					
					</div>
					
					<div class="product-tab">
						<ul class="nav nav-tabs">
						  <li class="active">
						  	<a href="#descraption" data-toggle="tab">Description</a>
						  </li>
						  <li>
						  	<a href="#return-info" data-toggle="tab">Return Info</a>
						  </li>
						</ul>
						<div class="tab-content">
							<div class="tab-pane active" id="descraption">
								<p>
									<?php echo $product->description; ?>
								</p>
							</div>
							<div class="tab-pane" id="return-info">
								<h4>Read our Returning info</h4><br>
								<p>
								Please contact us : 7/7 <br/>
								by email to: <?php echo $this->config->item('email')?> (reply in 24 hours) 
								</p>
							</div>
							
						</div> <!--end tab-content-->
					</div><!--end product-tab-->
				</div> <!--end span6-->


	<?php if(!empty($product->related_products)):?>


					<div class="related-product">
						<div class="titleHeader clearfix">
							<h3>Related Product</h3>
						</div><!--end titleHeader-->

						<div class="row">
						<ul class="hProductItems clearfix">
						
						
						<?php foreach($product->related_products as $relate):?>
							<li class="span3 clearfix">
								<?php
									$photo	= theme_img('no_picture.png', lang('no_image_available'));
									if(!empty($relate->primary_photo))
										$photo	= '<img src="'.base_url('images/thumbnails/'.$relate->primary_photo).'" alt="'.$relate->seo_title.'"/>';
								?>
						
								<div class="thumbnail">
									<a href="#"><?php echo $photo; ?></a>
								</div>
								
								<div class="thumbSetting">
									<div class="thumbTitle">
										<a href="<?php echo site_url($relate->slug); ?>" class="invarseColor">
											<?php echo $relate->name;?>
										</a>
									</div>
									<div class="thumbPrice">
										<span><?php echo format_currency($relate->price); ?></span>
									</div>

									<div class="thumbButtons">
										<button class="btn btn-primary btn-small" data-title="+To Cart" data-placement="top" rel="tooltip">
											<i class="icon-shopping-cart"></i>
										</button>
									</div>
								</div>
							</li>
				<?php endforeach;?>
						</ul>
						</div><!--end row-->
					</div><!--end related-product-->

	<?php endif;?>


</div>